<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet"
	type="text/css" />
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet"
	type="text/css" />
<!-- <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.css"
	rel="stylesheet" type="text/css" /> -->
<link href="lib/region/css/city-picker.css" rel="stylesheet"
	type="text/css" />
<link href="lib/region/css/main.css" rel="stylesheet" type="text/css" />

  <link href="css/bootstrap.css" rel="stylesheet">
  <script src="js/jquery.js"></script> 
  <script src="js/bootstrap.js"></script> 
  <link href="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.2/summernote.css" rel="stylesheet" >
  <script src="js/summernote.js"></script>
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>发布新发现需求</title>
</head>
<body>
<div class="pd-20">
	<form action="<%=path%>/backstage/requirement_discover-add" method="post" class="form form-horizontal" id="form-u_discover-add">
		<input type="hidden" id="id" name="id" value='${u_discover.id}' />
        
        <div class="row cl">
        	<label class="form-label col-xs-4 col-sm-3">需求关键字：</label>
			<div class="formControls col-xs-4 col-sm-4">
				 <input type="text" class="input-text" value="${u_discover.title}" placeholder="例如：上门修锁 ，帮我买菜" id="title" name="title" datatype="*" nullmsg="不能为空">
			</div>
			<div class="formControls col-xs-4 col-sm-3">
			<input type="checkbox" id="is_add" style="min-width:0px" name="is_add" value="0" <c:if test="${u_discover.is_add==1}">checked</c:if>><label for="is_add" style="margin-bottom:-5px">放入商业供需</label>
			</div>
		</div>
		
       
        
        <div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">需求起始时间：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<input type="text" class="input-text Wdate"
					onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
					value="${u_discover.begin_time}" placeholder="" id="begin_time"
					name="begin_time" datatype="*" nullmsg="不能为空">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">需求结束时间：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<input type="text" class="input-text Wdate"
					value="${u_discover.end_time}"
					onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" placeholder="" id="end_time"
					name="end_time" datatype="*" nullmsg="不能为空">
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">需求地址：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<input id="city-picker3" class="form-control" readonly
					name="regioninfo" type="text"
					value="//"
					data-toggle="city-picker">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">详细地址：</label>
			<div class="formControls col-xs-8 col-sm-5">
				<input type="text" class="input-text" value="${u_discover.address}"
					placeholder="" id="address" name="address" datatype="*" nullmsg="不能为空">
			</div>
		</div>
		
		<%-- <div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">需求图片：</label>
            <div class="formControls col-xs-8 col-sm-5">
            	<div id="fileList_pre_picture" class="uploader-list"></div>
					<div id="filePicker_pre_picture">选择图片</div>
					<input type="hidden" class="input-text"
						value="${u_discover.head_img}" placeholder=""
						id="head_img" name="head_img">
        	</div>
        </div> --%>
        <div class="row cl">
			<c:if test="${!empty u_discover.head_img}">
				<label class="form-label col-2">已有海报图：</label>
			</c:if>
				<input type="hidden" id="image_paths" name="image_paths" value="${u_discover.head_img}" />
			<div class="formControls col-10">
				<c:forEach items="${u_discover.head_img}" var="image" varStatus="varStatus">
					<div id="image_${image}"
						style="float: left; margin-right: 5px;">
						<div>
							<img src="${image}" alt="${u_discover.id}"
								height="50" border="0" /> 
						</div>
					</div>
				</c:forEach>
			</div>
		</div>
         <div class="row cl">
		<input type="hidden" id="image_list" name="image_list"
				value="${image_list}" /> 
		<input type="hidden" id="image_list_del"
				name="image_list_del" value="" />
			<label class="form-label col-xs-4 col-sm-3">需求图片：</label>
            <%-- <div class="formControls col-xs-8 col-sm-5">
            	<div id="fileList_pre_picture" class="uploader-list"></div>
					<div id="filePicker_pre_picture">选择图片</div>
					<input type="hidden" class="input-text"
						value="${u_discover.head_img}" placeholder=""
						id="head_img" name="head_img">
        	</div> --%>
        	<div class="formControls col-5">
					<div class="uploader-list-container">
						<div class="queueList">
							<div id="dndArea" class="placeholder">
								<div id="filePicker-2"></div>
								<p>广告尺寸：500*500px 格式：png</p>
							</div>
						</div>
						<div class="statusBar" style="display: none;">
							<div class="progress">
								<span class="text">0%</span> <span class="percentage"></span>
							</div>
							<div class="info"></div>
							<div class="btns">
								<div id="filePicker2"></div>
								<div class="uploadBtn">开始上传</div>
							</div>
						</div>
					</div>
				</div>
        </div>
		
	<%-- 	<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">需求说明：</label>
            <div class="formControls col-xs-8 col-sm-5">
                <textarea class="input-text" placeholder="" style="height:50px" id="" name="description">${u_discover.description}</textarea>
        	</div>
		</div> --%>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">需求说明：</label>
			<input type="hidden" id="description" name ="description" >
			<div class="formControls col-xs-8 col-sm-5">
		 		<div id="summernote" class="input-text">${u_discover.description}</div>
		 	</div>
		</div> 
        <div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<button onClick="u_discover_save_submit();"
					class="btn btn-primary radius" type="submit">
					<i class="Hui-iconfont">&#xe632;</i> 保存并提交
				</button>
				<button onClick="layer_close();" class="btn btn-default radius"
					type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
			</div>
		</div>

	</form>
</div>
<!-- <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> --> 
<script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
<script type="text/javascript"
	src="lib/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript"
	src="lib/webuploader/0.1.5/webuploader.min.js"></script>
<script type="text/javascript"
	src="lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript"
	src="lib/ueditor/1.4.3/ueditor.all.min.js"></script>
<script type="text/javascript" src="lib/region/js/city-picker.data.js"></script>
<script type="text/javascript" src="lib/region/js/city-picker.js"></script>
<script type="text/javascript" src="lib/region/js/main.js"></script>
<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="js/u_discover.js"></script>

<script type="text/javascript">
function u_discover_save_submit(){
	document.getElementById("description").value = $('#summernote').summernote('code');	
	$("#form-u_discover-add").Validform({
		tiptype:2,
		ajaxPost:true,
		callback:function(form){
			var index = parent.layer.getFrameIndex(window.name);
			if (index){//关闭弹出层
				parent.$('.btn-refresh').click(); 
				parent.layer.close(index);
			}else{//单独的页面
				location.href = "<%=path%>/backstage/u_requirement_discover-list"; 
			}
		}
	});
}
$(document).ready(function(){
	
	 $('#summernote').summernote({
		  height: 150    });
});

//图片上传demo
$(function() {

	/*外页上传*/
    var $list = $('#fileList_pre_picture'),
        ratio = window.devicePixelRatio || 1,
        thumbnailWidth = 100 * ratio,
        thumbnailHeight = 100 * ratio,
		uploader;

	uploader = WebUploader.create({
        auto: true,
        swf: 'lib/webuploader/0.1.5/Uploader.swf',
        server: '<%=path%>/backstage/goods-smallpic-upload',
        pick: '#filePicker_pre_picture',
        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
			mimeTypes: 'image/jpg,image/jpeg,image/png'
        }
    });

    uploader.on( 'fileQueued', function( file ) {
        var $li = $(
            '<div id="' + file.id + '" class="file-item thumbnail">' +
                '<img>' +
                '<div class="info">' + file.name + '</div>' +
            '</div>'
            ),
        $img = $li.find('img');

        $list.append( $li );
        uploader.makeThumb( file, function( error, src ) {
            if ( error ) {
                $img.replaceWith('<span>不能预览</span>');
                return;
            }

            $img.attr( 'src', src );
        }, thumbnailWidth, thumbnailHeight );
    });

    uploader.on( 'uploadSuccess', function(file, response) {
        $( '#'+file.id ).addClass('upload-state-done');
		$("#pre_picture").val(response.datas);
    });

    uploader.on( 'uploadError', function( file ) {
        var $li = $( '#'+file.id ),
            $error = $li.find('div.error');
        if ( !$error.length ) {
            $error = $('<div class="error"></div>').appendTo( $li );
        }

        $error.text('上传失败');
    });

    uploader.on( 'uploadComplete', function( file ) {
        $( '#'+file.id ).find('.progress').remove();
    });


});

</script>
</body>
</html>

